<template>
    <div :class="{'opacity_panel': !showPanel}" class="audit_panel">
        <!--催收操作面板-->
        <h2 style="padding-top: 10px; padding-left: 15px;"><i class="el-icon-menu"><b> {{ $t('collection.colRecordPanel') }}</b></i></h2>
        <!--催收记录start-->
        <div v-if="showPanel" class="audit_panel_module">
            <div class="panel_content tv_records">
                <el-form :rules="formRules" ref="urgingForm" :model="urgingForm" label-position="top">
                    <el-form-item :label="$t('common.telephoneNumber')" prop="collectPhone"><!--电话号码-->
                        <el-input type="text" v-model="urgingForm.collectPhone" :placeholder="$t('verify.plsInput')" maxlength="20"></el-input>
                    </el-form-item>
                    <el-form-item :label="$t('collection.colModus')" prop="collectMethod"><!--催收形式-->
                        <el-select v-model="urgingForm.collectMethod" :placeholder="$t('verify.plsChoose')">
                            <el-option v-for="opt in telOptList.collectMethod" :label="opt.value" :key="opt.value" :value="opt.value"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item prop="touchObj" :label="$t('collection.colObject')"><!--催收对象-->
                        <el-select v-model="urgingForm.touchObj" clearable :placeholder="$t('verify.plsChoose')">
                            <el-option v-for="opt in touchObjData" :label="opt.value" :key="opt.nid" :value="opt.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item prop="intimacy" :label="$t('collection.intimacy')"><!--亲密度效果-->
                        <el-select v-model="urgingForm.intimacy" clearable :placeholder="$t('verify.plsChoose')">
                            <el-option v-for="opt in intimacysData" :label="opt.value" :key="opt.nid" :value="opt.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item prop="telFeedBack" :label="$t('collection.contactResult')"><!--联络结果-->
                        <el-select v-model="urgingForm.telFeedBack" clearable placeholder="请选择" :placeholder="$t('verify.plsChoose')">
                            <el-option v-for="opt in telFeedBackData" :label="opt.value" :key="opt.nid" :value="opt.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item v-if="promiseDateShow" label="承诺还款时间" prop="promiseTime" :label="$t('collection.promiseRepayTime')">
                        <el-date-picker style="width: 100%;" v-model="urgingForm.promiseTime" :editable="false" :picker-options="pickerOptions" format="yyyy-MM-dd HH:mm" value-format="yyyy-MM-dd HH:mm" type="datetime" :placeholder="$t('verify.plsChoose')"></el-date-picker>
                    </el-form-item>
                    <el-form-item v-if="promiseDateShow" label="承诺还款金额" prop="promiseAmount" :label="$t('collection.promiseRepayAmount')">
                        <el-input type="text" v-model="urgingForm.promiseAmount" :placeholder="$t('verify.plsInput')" :maxlength="10"></el-input>
                    </el-form-item>
                    <el-form-item v-if="dimisstionShow" label="离职时间" prop="leaveOfficeTime" :label="$t('collection.separationTime')">
                        <el-date-picker style="width: 100%;" v-model="urgingForm.leaveOfficeTime" :editable="false" format="yyyy-MM-dd" value-format="timestamp" type="date" :placeholder="$t('verify.plsChoose')"></el-date-picker>
                    </el-form-item>
                    <!--选择三方代偿 承诺还款人和联系电话-->
                    <el-form-item v-if="threeSideShow" label="承诺还款人" prop="thirdRepayMan" :label="$t('collection.promisePerson')">
                        <el-input type="text" v-model="urgingForm.thirdRepayMan" :placeholder="$t('verify.plsInput')" :maxlength="20"></el-input>
                    </el-form-item>
                    <el-form-item v-if="threeSideShow" label="联系电话" prop="thirdRepayPhone" :label="$t('collection.contactPhone')">
                        <el-input type="text" v-model="urgingForm.thirdRepayPhone" :placeholder="$t('verify.plsInput')" :maxlength="20"></el-input>
                    </el-form-item>
                    <!--另设日期联系-->
                    <el-form-item v-if="chooseDateContact" label="联系时间" prop="setupContractTime" :label="$t('collection.contactTime')">
                        <el-date-picker style="width: 100%;" v-model="urgingForm.setupContractTime" :editable="false" :picker-options="pickerOptions" format="yyyy-MM-dd HH:mm" value-format="timestamp" type="datetime" :placeholder="$t('verify.plsChoose')"></el-date-picker>
                    </el-form-item>
                    <!--声明已缴-->
                    <el-form-item v-if="chooseRepay" label="还款时间" prop="statementRepayTime" :label="$t('common.repayTime')">
                        <el-date-picker style="width: 100%;" v-model="urgingForm.statementRepayTime" :editable="false" :picker-options="pickerOptionsBefore" format="yyyy-MM-dd HH:mm" value-format="timestamp" type="datetime" :placeholder="$t('verify.plsChoose')"></el-date-picker>
                    </el-form-item>
                    <el-form-item :label="$t('common.remark')" prop="remark"><!--备注-->
                        <el-input v-model="urgingForm.remark" type="textarea" :rows="9" :maxlength="300"></el-input>
                    </el-form-item>
                    <el-form-item prop="imgObj">
                        <upload-image v-model="urgingForm.imgObj">图片上传组件</upload-image>
                    </el-form-item>
                    <el-form-item v-if="urgingForm.imgObj.url" label="">
                        <img :src="urgingForm.imgObj.url">
                    </el-form-item>
                    <el-form-item class="form_btn">
                        <el-button @click="submitForm" type="primary">{{ $t('common.submit') }}</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
        <!--催收记录end-->
    </div>
</template>

<script>
    import EventBus from '@/libs/event-bus';
    import {eventConf} from '@/config/';
    import uploadImage from '@/components/upload-image';

    export default {
        name: 'auditPanel',
        components: {
            uploadImage,
        },
        props: {
            dictData:{
                default:null
            },
            showPanel: {
                type: Boolean,
                default: true
            }
        },
        data() {
            return {
                orderId: '',
                userId: '',
                overdueInfoId: '',
                type: '',
                urgingForm: {
                    collectPhone: '',
                    collectMethod: '',
                    touchObj: '',
                    intimacy: '',// 亲密度效果
                    telFeedBack: '',
                    remark: '',
                    imageUrl: '',
                    imgObj: {
                        id: '',
                        url: ''
                    },
                    promiseAmount: '', // 承诺还款金额
                    promiseTime: '', // 承诺还款时间
                    exceptionPrompt: '', // 手机号异常和工作信息异常的异常提示
                    leaveOfficeTime: '', // 离职时间
                    thirdRepayMan: '', // 承诺还款人
                    thirdRepayPhone: '', // 联系电话
                    setupContractTime: '', // 联系时间
                    statementRepayTime: '', // 还款时间
                },
                telOptList: {
                    collectMethod: [],
                    touchObj: [],
                    telFeedBack: []
                },
                formRules: {
                    collectPhone: [
                        {required: true, message: this.$t('verify.plsInput')},
                        {pattern: /^(\d)+$/, message: this.$t('verify.plsInputNumber')}
                    ],
                    collectMethod: [
                        {required: true, message: this.$t('verify.plsChoose')}
                    ],
                    touchObj: [
                        {required: true, message: this.$t('verify.plsChoose')}
                    ],
                    intimacy: [
                        { required: true, message: this.$t('verify.plsChoose') }
                    ],
                    telFeedBack: [
                        {required: true, message: this.$t('verify.plsChoose')}
                    ],
                    promiseTime: [
                        { required: true, message: this.$t('verify.plsChoose') }
                    ],
                    promiseAmount: [
                        { required: true, message: this.$t('verify.plsInput') },
                        {pattern: /^(\d)+$/, message: this.$t('verify.plsInputNumber')}
                    ],
                    exceptionPrompt: [
                        { required: true, message: this.$t('verify.plsChoose') }
                    ],
                    leaveOfficeTime: [
                        { required: true, message: this.$t('verify.plsChoose') }
                    ],
                    thirdRepayMan: [
                        { required: true, message: this.$t('verify.plsInput') }
                    ],
                    thirdRepayPhone: [
                        { required: true, message: this.$t('verify.plsInput') },
                    ],
                    remark: [],
                    promiseTime: []
                },
                pickerOptions: {
                    disabledDate(time) {
                        const now = new Date();
                        const today = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0);
                        return time.getTime() < today.getTime();
                    }
                },
                pickerOptionsBefore: {
                    disabledDate(time) {
                        const now = new Date();
                        const today = new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds());
                        return time.getTime() > today.getTime() + 1000;
                    }
                },
                callRecordId: '',
                touchObjData: [],
                telFeedBackData: [],
                intimacysData: [],
            };
        },
        computed: {
            // 选择承缴/减免
            promiseDateShow() {
                let isPromise = false;
                this.telOptList.telFeedBack.forEach((item) => {
                    if (item.value === this.urgingForm.telFeedBack && item.nid === 9) {
                        isPromise = true;
                    }
                });
                if (!isPromise) {
                    this.urgingForm.promiseTime = '';
                }
                return isPromise;
            },
            // 选择已离职
            dimisstionShow() {
                let unusualWork = false;
                this.telOptList.telFeedBack.forEach((item) => {
                    if (item.value === this.urgingForm.telFeedBack && item.nid === 3) {
                        unusualWork = true;
                    }
                });
                if (!unusualWork) {
                    this.urgingForm.leaveOfficeTime = '';
                }
                return unusualWork;
            },
            // 选择三方代偿
            threeSideShow() {
                let threeSide = false;
                this.telOptList.telFeedBack.forEach((item) => {
                    if (item.value === this.urgingForm.telFeedBack && item.nid === 10) {
                        threeSide = true;
                    }
                });
                if (!threeSide) {
                    this.urgingForm.promisePeople = '';
                    this.urgingForm.contactPhone = '';
                }
                return threeSide;
            },
            // 选择另设日期联系
            chooseDateContact() {
                let isHasChoose = false;
                this.telOptList.telFeedBack.forEach((item) => {
                    if (item.value === this.urgingForm.telFeedBack && item.nid === 8) {
                        isHasChoose = true;
                    }
                });
                if(!isHasChoose) {
                    this.urgingForm.setupContractTime = '';
                }
                return isHasChoose;
            },
            // 选择声明已缴
            chooseRepay() {
                let isHasRepay = false;
                this.telOptList.telFeedBack.forEach((item) => {
                    if (item.value === this.urgingForm.telFeedBack && item.nid === 11) {
                        isHasRepay = true;
                    }
                });
                if(!isHasRepay) {
                    this.urgingForm.statementRepayTime = '';
                }
                return isHasRepay;
            },
        },
        watch: {
            dictData:function(newVal,oldVal){
                if(newVal||oldVal){
                    this.getSelectOptions()
                }
                console.warn(newVal,oldVal,'dasdasdsad')
            },
            // 监听"催收对象"
            "urgingForm.touchObj": function(val) {
                let obj = this.telOptList.touchObj.filter( item => {
                    return item.value === val
                });
                if(obj && obj.length >= 1) {
                    this.intimacysData = this.telOptList.intimacys;
                    if(obj[0].nid === 1) {// 催收对象：本人
                        this.intimacysData = this.telOptList.intimacys.filter( item => {
                            return item.nid !== 1 // "亲密度效果"没有"无效"选项
                        });
                        this.telFeedBackData = this.telOptList.telFeedBack.filter( item => {
                            return (item.nid !== 1 && item.nid !== 2 && item.nid !== 3) // 联络结果：联系人造假、工作信息造假、离职
                        });
                    }
                }
                else {
                    this.intimacysData = this.telOptList.intimacys;
                    this.telFeedBackData = this.telOptList.telFeedBack;
                }
            },
            // 监听"亲密度效果"
            "urgingForm.intimacy": function(val) {
                let obj = this.telOptList.intimacys.filter( item => {
                    return item.value === val
                });
                let telFeedBackObj = this.telOptList.telFeedBack.filter( item => {
                    return item.value === this.urgingForm.telFeedBack
                });
                let touchObj = this.telOptList.touchObj.filter( item => {
                    return item.value === this.urgingForm.touchObj
                });
                if(obj && obj.length >= 1) {
                    //this.urgingForm.telFeedBack = '';
                    this.touchObjData = this.telOptList.touchObj;
                    this.telFeedBackData = this.telOptList.telFeedBack;
                    if(obj[0].nid === 1) {// 亲密度效果：无效
                        if(telFeedBackObj.length >= 1 && telFeedBackObj[0].nid !== 1 && telFeedBackObj[0].nid !== 2 && telFeedBackObj[0].nid !== 3 && telFeedBackObj[0].nid !== 4) {
                            this.urgingForm.telFeedBack = '';
                        }
                        this.touchObjData = this.telOptList.touchObj.filter( item => {
                            return item.nid !== 1 // "催收对象"没有"本人"选项
                        });
                        this.telFeedBackData = this.telOptList.telFeedBack.filter( item => {
                            return (item.nid === 1 || item.nid === 2 || item.nid === 3 || item.nid === 4) // 联络结果：联系人造假、工作信息造假、离职、投诉备注
                        });
                    }
                    if(obj[0].nid === 2) {// 亲密度效果：弱
                        if(telFeedBackObj.length >= 1 && telFeedBackObj[0].nid !== 5 && telFeedBackObj[0].nid !== 6 && telFeedBackObj[0].nid !== 4) {
                            this.urgingForm.telFeedBack = '';
                        }
                        this.telFeedBackData = this.telOptList.telFeedBack.filter( item => {
                            return (item.nid === 5 || item.nid === 6 || item.nid === 4) // 联络结果：失去联系/拒绝转告、疑似欺诈、投诉备注
                        });
                    }
                    if(obj[0].nid === 3) {// 亲密度效果：中
                        if(telFeedBackObj.length >= 1 && telFeedBackObj[0].nid !== 7 && telFeedBackObj[0].nid !== 8 && telFeedBackObj[0].nid !== 6 && telFeedBackObj[0].nid !== 4) {
                            this.urgingForm.telFeedBack = '';
                        }
                        this.telFeedBackData = this.telOptList.telFeedBack.filter( item => {
                            return (item.nid === 7 || item.nid === 8 || item.nid === 6 || item.nid === 4) // 联络结果：留口信、另设日期联系、疑似欺诈、投诉备注
                        });
                    }
                    if(obj[0].nid === 4) {// 亲密度效果：强
                        if(telFeedBackObj.length >= 1 && telFeedBackObj[0].nid !== 8 && telFeedBackObj[0].nid !== 9 && telFeedBackObj[0].nid !== 10 && telFeedBackObj[0].nid !== 11 && telFeedBackObj[0].nid !== 16 && telFeedBackObj[0].nid !== 4) {
                            this.urgingForm.telFeedBack = '';
                        }
                        this.telFeedBackData = this.telOptList.telFeedBack.filter( item => {
                            return (item.nid === 8 || item.nid === 9 || item.nid === 10 || item.nid === 11 || item.nid === 6 || item.nid === 4) // 联络结果：另设日期联系、承缴/减免、三方代偿、声明已缴、疑似欺诈、投诉备注
                        });
                    }
                    if(obj[0].nid === 5) {// 亲密度效果：未接通
                        if(telFeedBackObj.length >= 1 && telFeedBackObj[0].nid !== 12 && telFeedBackObj[0].nid !== 13 && telFeedBackObj[0].nid !== 14 && telFeedBackObj[0].nid !== 15 && telFeedBackObj[0].nid !== 16 && telFeedBackObj[0].nid !== 17 && telFeedBackObj[0].nid !== 18) {
                            this.urgingForm.telFeedBack = '';
                        }
                        this.telFeedBackData = this.telOptList.telFeedBack.filter( item => {
                            return (item.nid === 12 || item.nid === 13 || item.nid === 14 || item.nid === 15 || item.nid === 16 || item.nid === 17 || item.nid === 18) // 联络结果：无人接听、忙音/通话中、电话拒接、关机、无法接通、语音电话、短信通知
                        });
                    }
                    if(obj[0].nid === 6) {// 亲密度效果：停机
                        if(telFeedBackObj.length >= 1 && telFeedBackObj[0].nid !== 19) {
                            this.urgingForm.telFeedBack = '';
                        }
                        this.telFeedBackData = this.telOptList.telFeedBack.filter( item => {
                            return (item.nid === 19) // 联络结果：停机
                        });
                    }
                    if(obj[0].nid === 7) {// 亲密度效果：空号
                        if(telFeedBackObj.length >= 1 && telFeedBackObj[0].nid !== 20) {
                            this.urgingForm.telFeedBack = '';
                        }
                        this.telFeedBackData = this.telOptList.telFeedBack.filter( item => {
                            return (item.nid === 20) // 联络结果：空号
                        });
                    }
                }
                else {
                    if(touchObj && touchObj.length >= 1 && touchObj[0].nid === 1) {
                        this.telFeedBackData = this.telOptList.telFeedBack.filter( item => {
                            return (item.nid !== 1 && item.nid !== 2 && item.nid !== 3) // 联络结果：联系人造假、工作信息造假、离职
                        });
                    }
                    else {
                        this.telFeedBackData = this.telOptList.telFeedBack;
                    }
                    this.touchObjData = this.telOptList.touchObj;
                }
            },
            // 监听"联络结果"
            "urgingForm.telFeedBack": function(val) {
                let obj = this.telOptList.telFeedBack.filter(item => {
                    return item.value === val
                });
                let touchObj = this.telOptList.touchObj.filter( item => {
                    return item.value === this.urgingForm.touchObj
                });
                if (obj && obj.length >= 1) {
                    //this.intimacysData = this.telOptList.intimacys;
                    if(obj[0].nid === 1 || obj[0].nid === 2 || obj[0].nid === 3) {// 联络结果：联系人造假、工作信息造假、离职
                        this.intimacysData = this.telOptList.intimacys.filter( item => {
                            return item.nid === 1 // 亲密度效果：无效
                        });
                        this.touchObjData = this.telOptList.touchObj.filter( item => {
                            return item.nid !== 1 // "催收对象"没有"本人"选项
                        });
                    }
                    if(obj[0].nid === 4) {// 联络结果：投诉备注
                        this.intimacysData = this.telOptList.intimacys.filter( item => {
                            return (item.nid === 1 || item.nid === 2 || item.nid === 3 || item.nid === 4) // 亲密度效果：无效、弱、中、强
                        });
                        if(touchObj.length >= 1 && touchObj[0].nid === 1) {
                            this.intimacysData = this.telOptList.intimacys.filter( item => {
                                return (item.nid === 2 || item.nid === 3 || item.nid === 4) // 亲密度效果：弱、中、强
                            });
                        }
                    }
                    if(obj[0].nid === 5) {// 联络结果：失去联系/拒绝转告
                        this.intimacysData = this.telOptList.intimacys.filter( item => {
                            return item.nid === 2 // 亲密度效果：弱
                        });
                    }
                    if(obj[0].nid === 6) {// 联络结果：疑似欺诈
                        this.intimacysData = this.telOptList.intimacys.filter( item => {
                            return (item.nid === 2 || item.nid === 3 || item.nid === 4) // 亲密度效果：弱、中、强
                        });
                    }
                    if(obj[0].nid === 7) {// 联络结果：留口信
                        this.intimacysData = this.telOptList.intimacys.filter( item => {
                            return item.nid === 3 // 亲密度效果：中
                        });
                    }
                    if(obj[0].nid === 8) {// 联络结果：另设日期联系
                        this.intimacysData = this.telOptList.intimacys.filter( item => {
                            return (item.nid === 3 || item.nid === 4) // 亲密度效果：中、强
                        });
                    }
                    if(obj[0].nid === 9 || obj[0].nid === 10 || obj[0].nid === 11) {// 联络结果：承缴/减免、三方代偿、声明已缴
                        this.intimacysData = this.telOptList.intimacys.filter( item => {
                            return item.nid === 4 // 亲密度效果：强
                        });
                    }
                    if(obj[0].nid === 12 || obj[0].nid === 13 || obj[0].nid === 14 || obj[0].nid === 15 || obj[0].nid === 16 || obj[0].nid === 17 || obj[0].nid === 18) {// 联络结果：无人接听、忙音/通话中、电话拒接、关机、无法接通、语音电话、短信通知
                        this.intimacysData = this.telOptList.intimacys.filter( item => {
                            return item.nid === 5 // 亲密度效果：未接通
                        });
                    }
                    if(obj[0].nid === 19) {// 联络结果：停机
                        this.intimacysData = this.telOptList.intimacys.filter( item => {
                            return item.nid === 6 // 亲密度效果：停机
                        });
                    }
                    if(obj[0].nid === 20) {// 联络结果：空号
                        this.intimacysData = this.telOptList.intimacys.filter( item => {
                            return item.nid === 7 // 亲密度效果：空号
                        });
                    }
                }
                else if(this.urgingForm.touchObj) {
                    if(touchObj && touchObj.length >= 1) {
                        this.intimacysData = this.telOptList.intimacys;
                        if(touchObj[0].nid === 1) {// 催收对象：本人
                            this.intimacysData = this.telOptList.intimacys.filter( item => {
                                return item.nid !== 1 // "亲密度效果"没有"无效"选项
                            });
                        }
                    }
                }
                else {
                    this.touchObjData = this.telOptList.touchObj;
                    this.intimacysData = this.telOptList.intimacys;
                }
            }
        },
        methods: {
            compare(prop) {
                return function (obj1, obj2) {
                    var val1 = obj1[prop];
                    var val2 = obj2[prop];
                    if (!isNaN(Number(val1)) && !isNaN(Number(val2))) {
                        val1 = Number(val1);
                        val2 = Number(val2);
                    }
                    if (val1 < val2) {
                        return -1;
                    } else if (val1 > val2) {
                        return 1;
                    } else {
                        return 0;
                    }
                }
            },
            getSelectOptions() {
                this.telOptList.collectMethod = this.dictData.collectMethods;
                this.telOptList.touchObj = this.dictData.touchObjs.sort(this.compare('nid'));
                this.telOptList.telFeedBack = this.dictData.telFeedBacks;
                this.telOptList.intimacys = this.dictData.intimacys;
                this.touchObjData = this.telOptList.touchObj;
                this.telFeedBackData = this.telOptList.telFeedBack;
                this.intimacysData = this.telOptList.intimacys;
                console.warn(this.telOptList)
                // this.$api.collection.queryDictForNotes().then((res) => {
                    // const { status, data, error } = res;
                    // if (status === '1' && error === '00000000') {
                        // this.telOptList.collectMethod = data.collectMethods;
                        // this.telOptList.touchObj = data.touchObjs.sort(this.compare('nid'));
                        // this.telOptList.telFeedBack = data.telFeedBacks;
                        // this.telOptList.intimacys = data.intimacys;
                        // this.touchObjData = this.telOptList.touchObj;
                        // this.telFeedBackData = this.telOptList.telFeedBack;
                        // this.intimacysData = this.telOptList.intimacys;
                    // }
                // });
            },
            submitForm() {
//                this.$refs.urgingForm.validate((val) => {
//                    if (val) {
//                        let params = {
//                            callRecordId: this.callRecordId ? this.callRecordId : '0',
//                            overdueInfoId: this.overdueInfoId,
//                            // commitmentRepayDate: this.urgingForm.commitmentRepayDate,
//                            promiseTime: this.urgingForm.promiseTime,
//                        };
//                        params = Object.assign(params, this.urgingForm);
//                        if (params.promiseTime) {
//                            params.promiseTime = new Date(params.promiseTime).getTime();
//                        }
//                        this.$api.collection.addNotes(params).then((res) => {
//                            const {status, error} = res;
//                            if ('1' === status && error === '00000000') {
//                                this.$refs.urgingForm.resetFields();
//                                EventBus.$emit(eventConf.UPDATEURGINGRECORDS);
//                                // this.callDisable = false;
//                            }
//                        });
//                    }
//                });
                this.$refs.urgingForm.validate((val) => {
                    if (val) {
                        let collectMethod = this.telOptList.collectMethod.filter( item => {
                            return item.value === this.urgingForm.collectMethod;
                        });
                        let touchObj = this.touchObjData.filter( item => {
                            return item.value === this.urgingForm.touchObj;
                        });
                        let intimacy = this.intimacysData.filter( item => {
                            return item.value === this.urgingForm.intimacy;
                        });
                        let telFeedBack = this.telFeedBackData.filter( item => {
                            return item.value === this.urgingForm.telFeedBack;
                        });
                        let params = {
                            callRecordId: '0',
                            userId: this.userId,
                            collectionUserId: this.$storage.get('user').id,
                            orderId: this.orderId,
                            repayScheduleId: this.repayScheduleId,
                            overdueInfoId: this.overdueInfoId,
                        };
                        params = Object.assign(params, this.urgingForm);
                        params.imageUrl = this.urgingForm.imgObj.url;
                        params.collectMethod = collectMethod[0].nid;
                        params.touchObj = touchObj[0].nid;
                        params.intimacy = intimacy[0].nid;
                        params.telFeedBack = telFeedBack[0].nid;
                        if (params.promiseTime) {
                            params.promiseTime = new Date(params.promiseTime).getTime();
                        }
                        //params.commitmentRepayDate = params.promiseTime;
                        this.$api.collection.addNotes(params).then((res) => {
                            const {status, data, error} = res;
                            if ('1' === status && error === '00000000') {
                                this.$refs.urgingForm.resetFields();
                                EventBus.$emit(eventConf.UPDATEURGINGRECORDS);
                            }
                        });
                    }
                });
            }
        },
        created() {
            const params = this.$route.params;
            this.overdueInfoId = params.id;
            this.orderId = params.orderId;
            this.userId = params.userId;
            this.repayScheduleId = params.repayScheduleId;
            this.type = params.type;
            // this.getSelectOptions();
        }
    };
</script>

<style lang="scss" scoped>
    @import "~@/assets/scss/function";

    .audit_panel {
        /*padding: 0 16px;*/
    }

    .opacity_panel {
        opacity: 0.6;
    }

    .urging_panel_title {
        height: 52px;
        line-height: 52px;
        background-image: url("~@/assets/img/icon_edit.png");
        background-size: 20px 20px;
        background-repeat: no-repeat;
        background-position: left center;
        padding-left: 32px;
        border-bottom: 1px solid #d4d7da;
        margin: 0 16px;
    }

    .audit_panel_module {
        margin: 20px 0 30px;
    }

    .audit_panel_module_title {
        padding-left: 16px;
        border-left: 2px solid $primary;
        margin-bottom: 12px;
    }

    .panel_content {
        padding: 0 16px;
        font-size: 12px;
    }

    /*.warning_tips{*/
    /*font-size: 12px;*/
    /*}*/
    .tips_row {
        margin-top: 12px;
        color: #a6a8aa;
    }

    .tips_row_title {
        color: $colorText;
    }

    .tips_code, .tips_type {
        padding-right: 5px;
    }

    .form_btn {
        text-align: right;
    }

    .conclusion_radio {
        text-align: right;
    }
</style>
